cmake_minimum_required(VERSION 3.16)
project(SDL_Demo C)

set(CMAKE_C_STANDARD 99)

#SDL2所在目录
set(SDL2_DIR D:\\SDL2\\SDL2-2.0.14\\x86_64-w64-mingw32)
#SDL2 Image所在目录
set(SDL2IMAGE_DIR D:\\SDL2\\SDL2_image-2.0.5\\x86_64-w64-mingw32)
#SDL2 ttf所在目录
set(SDL2TTF_DIR D:\\SDL2\\SDL2_ttf-2.0.15\\x86_64-w64-mingw32)
#SDL2 mixer所在目录
set(SDL2MIXER_DIR D:\\SDL2\\SDL2_mixer-2.0.4\\x86_64-w64-mingw32)

aux_source_directory(./src SRC) #源文件目录(当前目录设置到变量DIR_SRC)
aux_source_directory(./src/demo DIR_SRC) #源文件目录(当前目录设置到变量DIR_SRC)
aux_source_directory(./src/demo2 DIR_SRC2) #源文件目录(当前目录设置到变量DIR_SRC)
aux_source_directory(./src/demo3 DIR_SRC3) #源文件目录(当前目录设置到变量DIR_SRC)
aux_source_directory(./src/game DIR_GAME) #源文件目录(当前目录设置到变量DIR_SRC)
aux_source_directory(./src/demo4 DIR_SRC4) #源文件目录(当前目录设置到变量DIR_SRC)
aux_source_directory(./src/tetris DIR_TETRIS) #源文件目录(当前目录设置到变量DIR_SRC)
aux_source_directory(./src/plane DIR_PLANE) #源文件目录(当前目录设置到变量DIR_SRC)
aux_source_directory(./src/demo5 DIR_SRC5) #源文件目录(当前目录设置到变量DIR_SRC)

# include目录
include_directories(${SDL2_DIR}\\include\\SDL2)
include_directories(${SDL2IMAGE_DIR}\\include\\SDL2)
include_directories(${SDL2TTF_DIR}\\include\\SDL2)
include_directories(${SDL2MIXER_DIR}\\include\\SDL2)
include_directories(include)

#库目录
link_directories(${SDL2_DIR}\\lib)
link_directories(${SDL2IMAGE_DIR}\\lib)
link_directories(${SDL2TTF_DIR}\\lib)
link_directories(${SDL2MIXER_DIR}\\lib)
# 库
link_libraries(mingw32 SDL2main SDL2 SDL2_image SDL2_ttf SDL2_mixer)

#add_executable(SDL_Demo WIN32 ${DIR_SRC}) # WIN32 去掉控制台（windows环境）
add_executable(SDL_Demo ${SRC})
target_sources(SDL_Demo  PRIVATE ${DIR_SRC}
${DIR_SRC2}
${DIR_SRC3}
${DIR_SRC4}
${DIR_GAME}
${DIR_TETRIS}
${DIR_PLANE}
${DIR_SRC5})